package cn.quicklydoit.mapper;

import cn.quicklydoit.entity.Company;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface CompanyMapper extends CrudRepository<Company,Long> {

    /**
     * 根据code 查询企业
     * @param code
     * @return
     */
    @Query(" from Company where code=:code")
    List<Company> findByCode(@Param("code") String code);

    /**
     * 启动状态下的企业
     * @return
     */
    @Query(" from Company where endDate is not null")
    List<Company> activeCompany();
}
